from logzero import logger as Logger
import logzero

from server.framework.core.settings import settings

if settings.logging_format == 'json':
    logzero.json()
if settings.logging_file_path != '':
    logzero.logfile(settings.logging_file_path, maxBytes=1e6, backupCount=3)

if settings.logging_level == 'info':
    logzero.loglevel(logzero.INFO)
if settings.logging_level == 'debug':
    logzero.loglevel(logzero.DEBUG)
if settings.logging_level == 'error':
    logzero.loglevel(logzero.ERROR)
if settings.logging_level == 'warn':
    logzero.loglevel(logzero.WARN)
logger = Logger
